package com.ssy.lingxi.after.sale.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 售后退货辅助国际化枚举
 * @author 彭冬冬
 * @date 2022/2/17
 * @version 2.0.0
 */
public enum ReturnGoodsHelpEnum {
    NO(1, "收货单号"),
    REFUND_SUCCEED(2, "已确认退款到账"),
    WAIT(3, "待确认退款到账"),
    ;
    private final Integer code;
    private final String message;

    ReturnGoodsHelpEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public static String getMessage(Integer code) {
        ReturnGoodsHelpEnum item = Arrays.stream(ReturnGoodsHelpEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        return null != item ? item.getMessage() : "";
    }
}
